import { createRouter, createWebHistory } from 'vue-router'
import OutfitRecommend from '../views/OutfitRecommend.vue'
import UserManagement from '../views/UserManagement.vue'

const routes = [
    {
        path: '/',
        name: 'OutfitRecommend',
        component: OutfitRecommend,
        meta: {
            title: '智能穿搭推荐系统'
        }
    },
    {
        path: '/users',
        name: 'UserManagement',
        component: UserManagement,
        meta: {
            title: '用户管理'
        }
    }
]

const router = createRouter({
    history: createWebHistory(import.meta.env.BASE_URL),
    routes
})

// 设置页面标题
router.beforeEach((to, from, next) => {
    if (to.meta.title) {
        document.title = to.meta.title
    }
    next()
})

export default router
